package com.bwie.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * @author : Yoo19
 * @description :
 * @createDate : 2025/5/5 18:26 26
 */
@Data
@Document(indexName = "es_log",shards = 1,replicas = 0)
public class EsLog implements Serializable {
    /**
     *
     */
    @Id
    @Field(type = FieldType.Keyword)
    private Integer logId;

    /**
     * 日志创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8",shape = JsonFormat.Shape.STRING)
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 操作者Id
     */
    @Field(type = FieldType.Integer)
    private Integer optId;

    /**
     * 操作人
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String optName;

    /**
     * 操作人ip地址
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String ip;

    /**
     * 日志名称
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String logName;

    /**
     * 日志类型：0未知1登录2修改3添加4删除5支付
     */
    @Field(type = FieldType.Integer)
    private Integer logType;

    /**
     *
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String logContent;


    private static final long serialVersionUID = 1L;
}
